import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {NewsdetailComponent} from './components/newsdetail/newsdetail.component';
import {NewslistComponent} from './components/newslist/newslist.component';
import {CarouselComponent} from './components/carousel/carousel.component';
import {Mp3playComponent} from './components/mp3play/mp3play.component';
import {VideoplayComponent} from './components/videoplay/videoplay.component';
import {IndexComponent} from './components/index/index.component';
import {P401Component} from './components/p401/p401.component';
import {P403Component} from './components/p403/p403.component';
import {AdminGuard} from './guards/admin.guard';
import {RegistComponent} from './components/regist/regist.component';
import {UserinfoComponent} from './components/userinfo/userinfo.component';

const routes: Routes = [
  {path:'newsdetail',component:NewsdetailComponent},
  {path:'newslist',component:NewslistComponent},
  { path: 'admin', loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule),canActivate:[AdminGuard] },
  {path:'carousel',component: CarouselComponent},
  {path: 'mp3play',component: Mp3playComponent},
  {path: 'videoplay',component: VideoplayComponent},
  {path: 'index',component: IndexComponent},

  {path:'p401',component: P401Component},
  {path:'p403',component: P403Component},
  {path:'regist',component:RegistComponent},
  {path: 'userinfo',component:UserinfoComponent},
  {path: '',redirectTo:'index',pathMatch:'full'}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
